import java.awt.Graphics;
import java.awt.Image;
import java.io.IOException;

import javax.imageio.ImageIO;


public class Explosion extends Entity{
	
	private Image sprite;
	private double x=0;
	private double y=0;
	private int k=0,cf=0,fps=120;
	private boolean fin=false;

	public Explosion() {
		
		try {
			sprite = ImageIO.read(getClass().getResource("explosion.png"));
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}

	@Override
	public void draw(Graphics g) {

		g.drawImage(sprite, (int)x, (int)y, (int)x+64, (int)y+64, k*64, k*64, (k+1)*64, (k+1)*64, null);
		
		if (cf >= fps) {
			cf=0;
			k+=1;
			
			if (k >= 4){
				k=0;
				fin=true;
			}
		}
		cf+=1;
	}

	@Override
	public void move() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void move(double dx, double dy) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void setX(double x) {
		this.x = x;
	}

	@Override
	public void setY(double y) {
		this.y = y;
	}

	@Override
	public double getX() {
		// TODO Auto-generated method stub
		return x;
	}

	@Override
	public double getY() {
		// TODO Auto-generated method stub
		return y;
	}

	@Override
	public int getCadence() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void setLife() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public int getLife() {
		// TODO Auto-generated method stub
		return 0;
	}
	
	public boolean getFin() {
		// TODO Auto-generated method stub
		return fin;
	}
}
